let { path } = require('../config/config')

fileUploadImg = (req, res, next) => {
    if (req?.file) {
        res.json({
            code: 200,
            message: "图片上传成功",
            url: req.file.destination.replace("public", path) + req.file.filename
        })
    } else {
        res.json({
            code: 201,
            message: "图片上传失败"
        })
    }
}

module.exports = {
    fileUploadImg
}